﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Kinect;
namespace kinect8.Toolkit
{
    public class GestureManager
    {
        public delegate void GestureDetectedHandler(object sender, GestureEventArgs args);
        Dictionary<string, GestureDetector> detectors;
        public GestureDetectedHandler GestureHandler { set; get; }


        public GestureManager(GestureDetectedHandler handler, KinectSensor sensor)
        {
            detectors = new Dictionary<string, GestureDetector>();
            GestureHandler = handler;
            
        }

        public void TrackSkeleton(Skeleton skeleton)
        {

            foreach (GestureDetector detector in detectors.Values)
            {
                if (detector.Enable)
                {
                    detector.TrackGesture(skeleton);

                }
            }
            
        }

        public void AddGesture(string name, GestureDetector detector)
        {
            detectors.Add(name, detector);
        }

        public void SetEnable(string detectorname, bool enable)
        {
            detectors[detectorname].Enable = enable;
        }



    }
}
